﻿<UserControl x:Class="GISforTT_API.CornerMenu"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:s="http://schemas.microsoft.com/surface/2008"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <!--The new style for the round buttons-->
        <Style TargetType="{x:Type Button}" x:Key="newRoundButton">
            <Style.Resources>
                <!-- colors -->
                <LinearGradientBrush x:Key="roundButtonBackground" StartPoint="0,0" EndPoint="0,1">
                    <GradientStop Color="Red" />
                    <GradientStop Color="Yellow" Offset="1" />
                </LinearGradientBrush>

                <LinearGradientBrush x:Key="disabledRoundButtonBackground" StartPoint="0,0" EndPoint="0,1">
                    <GradientStop Color="#555" />
                    <GradientStop Color="#CCC" Offset="1" />
                </LinearGradientBrush>

                <RadialGradientBrush x:Key="mouseOverRoundButtonBackground">
                    <GradientStop Color="#FFF9F7A9" Offset="0" />
                    <GradientStop Color="Yellow" Offset="0.2" />
                    <GradientStop Color="Orange" Offset="0.7" />

                    <GradientStop Color="Red" Offset="1" />
                </RadialGradientBrush>

                <LinearGradientBrush x:Key="glossShineBrush" StartPoint="0,0" EndPoint="0,1">
                    <GradientStop Color="#DDFFFFFF" Offset="0" />
                    <GradientStop Color="#33FFFFFF" Offset="1" />
                </LinearGradientBrush>

                <SolidColorBrush x:Key="roundButtonStroke" Color="Red" />

                <SolidColorBrush x:Key="disabledRoundButtonStroke" Color="#333" />

                <DropShadowEffect x:Key="focusEffect" ShadowDepth="0" Color="Orange" BlurRadius="4"  />
                <DropShadowEffect x:Key="pressedEffect" ShadowDepth="0" Color="Red" BlurRadius="6"  />

            </Style.Resources>

            <Setter Property="Foreground" Value="Black" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" >
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*" />
                                <RowDefinition Height="7*" />
                                <RowDefinition Height="7*" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="5*" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Ellipse x:Name="bgEllipse" Grid.ColumnSpan="3" Grid.RowSpan="3" Fill="{StaticResource 
                                roundButtonBackground}" Stroke="{StaticResource roundButtonStroke}" />
                            <ContentPresenter Grid.RowSpan="3" Grid.ColumnSpan="3" HorizontalAlignment="Center" 
                                              VerticalAlignment="Center" RecognizesAccessKey="True" />
                            <Ellipse x:Name="shine" Grid.Row="1" Grid.Column="1" Fill="{StaticResource glossShineBrush}" />
                        </Grid>

                        <ControlTemplate.Triggers>
                            <Trigger Property="IsKeyboardFocused" Value="true">
                                <Setter TargetName="bgEllipse" Property="Effect" Value="{StaticResource focusEffect}" />
                            </Trigger>
                            <Trigger Property="IsPressed" Value="true">
                                <Setter TargetName="shine" Property="Opacity" Value="0.35" />
                                <Setter TargetName="bgEllipse" Property="Effect" Value="{StaticResource pressedEffect}" />
                            </Trigger>
                            <Trigger Property="IsDefaulted" Value="true">
                                <Setter TargetName="bgEllipse" Property="StrokeThickness" Value="1.5" />
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="true">
                                <Setter TargetName="bgEllipse" Property="Fill" Value="{StaticResource mouseOverRoundButtonBackground}" />
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter TargetName="bgEllipse" Property="Fill" Value="{StaticResource disabledRoundButtonBackground}"/>
                                <Setter TargetName="bgEllipse" Property="Stroke" Value="{StaticResource disabledRoundButtonStroke}" />
                            </Trigger>
                        </ControlTemplate.Triggers>

                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <ImageBrush x:Key="ElectricityOverlay" Stretch="Fill" Opacity="0.5" ImageSource="Resources/Electricity.png"/>
        <ImageBrush x:Key="Find" Stretch="Fill" ImageSource="Resources/Buttons/Find.png"/>
        <ImageBrush x:Key="List" Stretch="Fill" ImageSource="Resources/Buttons/List.png"/>
        <ImageBrush x:Key="Exit" Stretch="Fill" ImageSource="Resources/Buttons/Exit.png"/>
        <ImageBrush x:Key="Config" Stretch="Fill" ImageSource="Resources/Buttons/Config.png"/>
        
    </UserControl.Resources>
    
    <Grid>        
        <Grid x:Name="ExpandedMenu" Visibility="Hidden">
            
            <Ellipse x:Name="ExpandedMenuEllipse" Stroke="AliceBlue" StrokeThickness="4" 
                     Fill="LightBlue" Margin="0,0,0,0" Width="280" Height="280"
                     MouseLeftButtonDown="ExpandedMenuEllipse_Click"/>
            
            <Grid x:Name="ButtonsGrid" Margin="0,0,0,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="150*"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="30"/>
                    <ColumnDefinition Width="30"/>
                    <ColumnDefinition Width="30"/>
                    <ColumnDefinition Width="30"/>
                    <ColumnDefinition Width="30"/>
                    <ColumnDefinition Width="150*"/>
                </Grid.ColumnDefinitions>
            </Grid>
        </Grid>
        
        <Ellipse x:Name="CollapsedMenu" Stroke="AliceBlue" StrokeThickness="4" 
                 Fill="{StaticResource ElectricityOverlay}" Width="200" Height="200"
                 MouseLeftButtonDown="CollapsedMenu_Click" />
    </Grid>
</UserControl>
